/*****************************************************************************
  NAME:  mspspi.h

  PURPOSE:

      This file contains macros and function prototypes that define the
      SPI for the MSP service.
  HISTORY:
  7/14/99   SL  Added MSP_CHANNEL_PARM argument to mspSpiCreateChannel().

  7/13/99   SL  Created.

  ****************************************************************************/

#ifndef MSPSPI_INCLUDED
#define MSPSPI_INCLUDED


/* Standard CT Access include files. */
#include <nmstypes.h>
#include <ctadef.h>
#include "mspdef.h"
//#include "mspparm.h"


/* Prevent C++ name mangling. */
#ifdef __cplusplus
extern "C"
{
#endif

/*-----------------------------------------------------------------------------
  MSP SPI Compatibility Level Id
    - This id is used to determine runtime compatibility between the
      installed XXX service and clients of the MSP service. Clients can
      be another CT Access Service (which access MSP functionality
      via the MSP SPI).
    - Clients check this id value via CTAREQSVC_INFO structure
      passed with dispRegisterService in its service implementation
      of mspDefineService binding function.
    - SPI compatiblity level value is be incremented when the associated
      source module changes in a non-backwards compatible way.
  ---------------------------------------------------------------------------*/
#define MSPSPI_COMPATLEVEL                  1



/*-----------------------------------------------------------------------------
  Associated MSP Service SPI function prototypes.
    - For each API call, there is an associated SPI call which performs
      argument marshalling and invokes dispSendCommand() for processing.
    - Note that the only difference between the API signature and the SPI
      signature is the extra "source" argument.
    - Also note that if another service needed to call a Service function,
      it would call the SPI function - NOT THE API FUNCTION!
  ---------------------------------------------------------------------------*/


/*-----------------------------------------------------------------------------
    ctahd:    Handle for CT Access context to start.
    arg1:     Some DWORD argument.  May be modified to any type of pass
              argument.
    arg2:     Some structure argument.  May be modified to any type of pass
              argument.
    source:   Service ID of calling service.  Either Application or Another
              CT Access compliant service.


  Returns SUCCESS on successful execution, otherwise returns a CT Access
  or Service specific error code on failure.
  ---------------------------------------------------------------------------*/

    // Endpoint operations
    DWORD NMSAPI mspSpiCreateEndpoint( CTAHD hCta,
                                       MSP_ENDPOINT_ADDR* pAddr,
                                       MSP_ENDPOINT_PARAMETER* pParm,
                                       MSPHD* phEp,
                                       WORD source );

    DWORD NMSAPI mspSpiDestroyEndpoint( MSPHD hEp,
                                        WORD source );

    // Channel operations
    DWORD NMSAPI mspSpiCreateChannel( CTAHD hCta,
                                      MSP_CHANNEL_ADDR* pAddr,
                                      MSP_CHANNEL_PARAMETER* pParm,
                                      MSPHD* phChan,
                                      WORD source );

    DWORD NMSAPI mspSpiDestroyChannel( MSPHD hChan,
                                       WORD source );

    // Connect operations
    DWORD NMSAPI mspSpiConnect( MSPHD hEp1,
                                MSPHD hChan,
                                MSPHD hEp2,
                                WORD source );

    DWORD NMSAPI mspSpiDisconnect( MSPHD hEp1,
                                   MSPHD hChan,
                                   MSPHD hEp2,
                                   WORD source );

    // Enable and Disable operations
    DWORD NMSAPI mspSpiEnableEndpoint( MSPHD hEp,
                                       WORD source );

    DWORD NMSAPI mspSpiDisableEndpoint( MSPHD hEp,
                                        WORD source );

    DWORD NMSAPI mspSpiEnableChannel( MSPHD hChan,
                                      WORD source );

    DWORD NMSAPI mspSpiDisableChannel( MSPHD hChan,
                                       WORD source );


    DWORD NMSAPI mspSpiSendCommand( MSPHD hChan,
                                    DWORD Command,
                                    void* pBuffer,
                                    DWORD size,
                                    WORD source);

    // Query Operations
    DWORD NMSAPI mspSpiQuery( MSPHD hMsp,
                              DWORD Command,
                              WORD source);

    // Release an MSP Service buffer
    DWORD NMSAPI mspSpiReleaseBuffer( CTAHD hCtahd,
                                      void *buffer,
                                      WORD source);

    // Get Filter Handle (synchronous)
    DWORD NMSAPI mspSpiGetFilterHandle( MSPHD hMsp,
                                        DWORD Filter,
                                        DWORD* pHandle,
                                        WORD source);

#ifdef __cplusplus
}
#endif


#endif /* MSPSPI_INCLUDED */

